package com.pcbly.web.persistence.form;
 
import java.util.List; 


import com.pcbly.web.bean.field.FormSortBean;
import com.pcbly.web.bean.field.FormTypeBean;
import com.pcbly.web.persistence.HibernateBaseDao;

public class FormTypeHibernateDao extends HibernateBaseDao<FormTypeBean>
		implements FormTypeDao {

	/**
	 * 
	 */
	private static final long serialVersionUID = -5426248366002375859L;
	public FormTypeHibernateDao(){
		super();
	}
	protected Class<FormTypeBean> getEntityClass() {
		return FormTypeBean.class;
	}


	@SuppressWarnings("unchecked")
	public List<FormTypeBean> findFormTypeBeansBySortId(String formSortId)
			throws Exception {
		// TODO Auto-generated method stub
		FormSortBean formSortBean=new FormSortBean();
		formSortBean.setId(formSortId);
		
		return getHibernateTemplate().find(" from FormTypeBean sort where sort.formSortBean=? ", formSortBean);
	}
	public FormTypeBean findFormTypeBeanById(String Id) throws Exception {
		// TODO Auto-generated method stub
		return super.get(getEntityClass(), Id);
	}
	public void saveFormType(FormTypeBean bean) throws Exception {
		// TODO Auto-generated method stub
		getHibernateTemplate().save(bean); 
		
//		Work work=getHibernateTemplate().
//		getSession().doWork()
//		super.saveObject(bean);
	}
	@Override
	public void updateFormType(FormTypeBean bean) throws Exception {
		// TODO Auto-generated method stub
		getHibernateTemplate().update(bean);
	}
}
